<template>
	<view class="content">
		<view class="contentbox" :style="'height:'+headHeight+'px;background-color: rgba(255, 255, 255, '+nums+')'">
			<view class="container" :style="'height:'+navBarHeight+'px;top:'+imageTop+'px;'">
				<image :src="imageUrl +'left2.png'" mode="widthFix" class="logo" @click="goBack"></image>
				
				<view class="title-names">详情</view>
			</view>
		</view>
		<image :src="imageUrl +'bgimg.png'" mode="widthFix" class="bg-img"></image>
		<view class="nos" :style="'margin-top: '+headHeight+'px;'"></view>
		<view class="big-box">
			<view class="title">{{realTimeInfo.title}}</view>
			<view class="down" v-if="false">
				<view class="l-con">夷陵城市停车 5小时前</view>
				<view class="look-con">
					<image :src="imageUrl +'look.png'" mode="widthFix"></image>
					<view>152 浏览量</view>
				</view>
			</view>
			<image :src="imageUrl + 'zixun/' +realTimeInfo.img+'.jpg'" mode="aspectFill" class="imgs"></image>
			<view class="worde">
{{realTimeInfo.memo}}
			</view>
		</view>
		<view class="null"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				headHeight: 0,
				navBarHeight: 0,
				imageTop: 0,
				right: 0,
				nums: 0,
				realTimeInfo : {},
			}
		},
		onLoad(options) {
			// 获取胶囊按钮位置
			// 获取系统信息（主要是状态栏高度）
			const menuButtonInfo = uni.getMenuButtonBoundingClientRect();
			const systemInfo = uni.getSystemInfoSync();

			// 计算顶部总高度：从屏幕顶部到导航栏底部的距离
			const statusBarHeight = systemInfo.statusBarHeight; // 状态栏高度
			const navBarHeight = menuButtonInfo.height + (menuButtonInfo.top - statusBarHeight) * 2; // 导航栏高度
			const totalTopHeight = statusBarHeight + navBarHeight; // 顶部总高度（含状态栏+导航栏）

			this.headHeight = totalTopHeight
			this.navBarHeight = menuButtonInfo.height
			this.imageTop = menuButtonInfo.top
			this.right = menuButtonInfo.width + 20
			
			this.realTimeInfo =JSON.parse(decodeURIComponent(options.item));
			
		},
		methods: {
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			}
		},
		onPageScroll(e) {
			if (e.scrollTop > 10) {
				console.log(111)
				this.nums = 1
			} else {
				this.nums = 0
				console.log(222)
			}
		},
	}
</script>

<style lang="scss">
	page {
		background-color: #F4FAF7;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.bg-img {
		width: 750rpx;
		height: 520rpx;
		position: absolute;
		top: 0;
	}

	.contentbox {
		width: 750rpx;
		position: fixed;
		top: 0;
		z-index: 999;
		transition: background-color 500ms;
		background-color: #ffffff00;

		.container {
			width: 750rpx;
			position: absolute;
			bottom: 0rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			height: 86rpx;

			.title-names {
				width: 750rpx;
				position: absolute;
				text-align: center;
			}

			.logo {
				margin-left: 18rpx;
				width: 40rpx;
				height: 40rpx;
				position: relative;
				z-index: 9999;
			}

			.seandcode {
				width: 64rpx;
				height: 64rpx;
				position: relative;
				z-index: 9999;
			}
		}
	}

	.big-box {
		width: 690rpx;
		position: relative;
		margin-top: 30rpx;

		.title {
			width: 100%;
			font-size: 36rpx;
			color: #1C274C;
		}

		.down {
			width: 100%;
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-top: 28rpx;

			.l-con {
				font-size: 24rpx;
				color: rgba(40, 40, 40, 0.6);
			}

			.look-con {
				display: flex;
				align-items: center;

				image {
					width: 24rpx;
					height: 24rpx;
				}

				view {
					font-size: 24rpx;
					color: rgba(40, 40, 40, 0.6);
					margin-left: 10rpx;
				}
			}
		}

		.imgs {
			width: 100%;
			margin-top: 30rpx;
		}

		.worde {
			width: 100%;
			font-size: 28rpx;
			color: rgba(40, 40, 40, 0.6);
			margin-top: 30rpx;
		}
	}
	.null {
		width: 750rpx;
		height: 20rpx;
		padding-bottom: env(safe-area-inset-bottom);
	}
</style>